package com.tdkj.action.backstage.shop;

import java.math.BigDecimal;
import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.shop.BeanShopRecommendationCustom;
import com.tdkj.model.shop.BeanShopRecommendationType;
import com.tdkj.service.shop.IBeanShopRecommendationCustomService;

public class ShopRecommendationCustomAction extends BaseAction {

	private IBeanShopRecommendationCustomService shopRecommendationCustomService ;
	
	/**
	 * @param shopRecommendationCustomService the shopRecommendationCustomService to set
	 */
	@Resource
	public void setShopRecommendationCustomService(
			IBeanShopRecommendationCustomService shopRecommendationCustomService) {
		this.shopRecommendationCustomService = shopRecommendationCustomService;
	}

	private Long id;
	private BigDecimal timeLimitQuantity;
	private String timeLimitUnit;
	private BigDecimal price;
	private String unit;
	private Long scoreLower;
	private Integer goodNumber;
	private Long typeId;
	private BeanShopRecommendationCustom custom;
	private List<BeanShopRecommendationCustom> customs;

	private BeanShopRecommendationType type;

	public String execute(){
		type = shopRecommendationCustomService.findById(typeId, BeanShopRecommendationType.class);
		customs = shopRecommendationCustomService.getByTypeId(typeId);
		return "success";
	}
	
	public String edit(){
		custom = shopRecommendationCustomService.findById(id, BeanShopRecommendationCustom.class);
		return "edit";
	}
	
	public String add(){
		shopRecommendationCustomService.add(typeId, timeLimitQuantity, timeLimitUnit, price, unit, scoreLower, goodNumber);
		return execute();
	}
	
	public String update(){
		shopRecommendationCustomService.update(id, typeId, timeLimitQuantity, timeLimitUnit, price, unit, scoreLower, goodNumber);
		return edit();
	}
	
	public String delete(){
		shopRecommendationCustomService.delete(id, BeanShopRecommendationCustom.class);
		return execute();
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the timeLimitQuantity
	 */
	public BigDecimal getTimeLimitQuantity() {
		return timeLimitQuantity;
	}

	/**
	 * @param timeLimitQuantity the timeLimitQuantity to set
	 */
	public void setTimeLimitQuantity(BigDecimal timeLimitQuantity) {
		this.timeLimitQuantity = timeLimitQuantity;
	}

	/**
	 * @return the timeLimitUnit
	 */
	public String getTimeLimitUnit() {
		return timeLimitUnit;
	}

	/**
	 * @param timeLimitUnit the timeLimitUnit to set
	 */
	public void setTimeLimitUnit(String timeLimitUnit) {
		this.timeLimitUnit = timeLimitUnit;
	}

	/**
	 * @return the price
	 */
	public BigDecimal getPrice() {
		return price;
	}

	/**
	 * @param price the price to set
	 */
	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	/**
	 * @return the scoreLower
	 */
	public Long getScoreLower() {
		return scoreLower;
	}

	/**
	 * @param scoreLower the scoreLower to set
	 */
	public void setScoreLower(Long scoreLower) {
		this.scoreLower = scoreLower;
	}

	/**
	 * @return the goodNumber
	 */
	public Integer getGoodNumber() {
		return goodNumber;
	}

	/**
	 * @param goodNumber the goodNumber to set
	 */
	public void setGoodNumber(Integer goodNumber) {
		this.goodNumber = goodNumber;
	}

	/**
	 * @return the typeId
	 */
	public Long getTypeId() {
		return typeId;
	}

	/**
	 * @param typeId the typeId to set
	 */
	public void setTypeId(Long typeId) {
		this.typeId = typeId;
	}

	/**
	 * @return the custom
	 */
	public BeanShopRecommendationCustom getCustom() {
		return custom;
	}

	/**
	 * @param custom the custom to set
	 */
	public void setCustom(BeanShopRecommendationCustom custom) {
		this.custom = custom;
	}

	/**
	 * @return the customs
	 */
	public List<BeanShopRecommendationCustom> getCustoms() {
		return customs;
	}

	/**
	 * @param customs the customs to set
	 */
	public void setCustoms(List<BeanShopRecommendationCustom> customs) {
		this.customs = customs;
	}

	/**
	 * @return the type
	 */
	public BeanShopRecommendationType getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(BeanShopRecommendationType type) {
		this.type = type;
	}

	/**
	 * @return the unit
	 */
	public String getUnit() {
		return unit;
	}

	/**
	 * @param unit the unit to set
	 */
	public void setUnit(String unit) {
		this.unit = unit;
	}
	
	
	
}
